package com.google.project.server.entity;

import java.io.Serializable;

import javax.jdo.annotations.Extension;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.project.shared.ProjectReportDetailDTO;

@SuppressWarnings("serial")
@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = "true")
public class ProjectReportDetail implements Serializable{
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	@Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = "true")
	private String id;
	@Persistent
	private String reportId;
	@Persistent
	private String taskId;
	@Persistent
	private String taskName;
	@Persistent
	private Long startDate;
	@Persistent
	private Long dueDate;
	@Persistent
	private Double amountOfWork;
	@Persistent
	private Double finishWork;
	@Persistent
	private String content;
	@Persistent
	private String projectId;
	@Persistent
	private String unit;
	
	@Persistent
	private ProjectReport projectReport;
	
	@Persistent
	private int index;
	public ProjectReportDetail() {
	}
	
	public ProjectReportDetail(String id, String reportId, String taskId,
			String taskName, Long startDate, Long dueDate, Double amountOfWork,
			Double finishWork,String content,String projectId,String unit) {
		super();
		this.id = id;
		this.reportId = reportId;
		this.taskId = taskId;
		this.taskName = taskName;
		this.startDate = startDate;
		this.dueDate = dueDate;
		this.amountOfWork = amountOfWork;
		this.finishWork = finishWork;
		this.content=content;
		this.projectId=projectId;
		this.unit=unit;
	}

	public ProjectReportDetail(ProjectReportDetailDTO projectReportDetailDTO) {
		this.taskId = projectReportDetailDTO.getTaskId();
		this.taskName = projectReportDetailDTO.getTaskName();
		this.startDate = projectReportDetailDTO.getStartDate();
		this.dueDate = projectReportDetailDTO.getDueDate();
		this.amountOfWork = projectReportDetailDTO.getAmountOfWork();
		this.finishWork = projectReportDetailDTO.getFinishWork();
		this.content=projectReportDetailDTO.getContent();
		this.projectId=projectReportDetailDTO.getProjectId();
		this.unit=projectReportDetailDTO.getUnit();
	}

	public ProjectReportDetailDTO toDTO() {
		ProjectReportDetailDTO data = new ProjectReportDetailDTO();
		data.setId(id);
		data.setAmountOfWork(amountOfWork);
		data.setDueDate(dueDate);
		data.setFinishWork(finishWork);
		data.setStartDate(startDate);
		data.setTaskId(taskId);
		data.setTaskName(taskName);
		data.setProjectId(projectId);
		data.setContent(content);
		data.setUnit(unit);
		return data;
	}
	public void updateFromDTO(ProjectReportDetailDTO projectReportDetailDTO) {
		this.taskId = projectReportDetailDTO.getTaskId();
		this.taskName = projectReportDetailDTO.getTaskName();
		this.startDate = projectReportDetailDTO.getStartDate();
		this.dueDate = projectReportDetailDTO.getDueDate();
		this.amountOfWork = projectReportDetailDTO.getAmountOfWork();
		this.finishWork = projectReportDetailDTO.getFinishWork();
		this.content=projectReportDetailDTO.getContent();
		this.projectId=projectReportDetailDTO.getProjectId();
		this.unit=projectReportDetailDTO.getUnit();
	}
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getReportId() {
		return reportId;
	}

	public void setReportId(String reportId) {
		this.reportId = reportId;
	}

	public String getTaskId() {
		return taskId;
	}

	public void setTaskId(String taskId) {
		this.taskId = taskId;
	}

	public String getTaskName() {
		return taskName;
	}

	public void setTaskName(String taskName) {
		this.taskName = taskName;
	}

	public Long getStartDate() {
		return startDate;
	}

	public void setStartDate(Long startDate) {
		this.startDate = startDate;
	}

	public Long getDueDate() {
		return dueDate;
	}

	public void setDueDate(Long dueDate) {
		this.dueDate = dueDate;
	}

	public Double getAmountOfWork() {
		return amountOfWork;
	}

	public void setAmountOfWork(Double amountOfWork) {
		this.amountOfWork = amountOfWork;
	}

	public Double getFinishWork() {
		return finishWork;
	}

	public void setFinishWork(Double finishWork) {
		this.finishWork = finishWork;
	}

	public ProjectReport getProjectReport() {
		return projectReport;
	}

	public void setProjectReport(ProjectReport projectReport) {
		this.projectReport = projectReport;
	}

	public String getProjectId() {
		return projectId;
	}

	public void setProjectId(String projectId) {
		this.projectId = projectId;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public int getIndex() {
		return index;
	}

	public void setIndex(int index) {
		this.index = index;
	}

	public String getUnit() {
		return unit;
	}

	public void setUnit(String unit) {
		this.unit = unit;
	}
	
	
}
